<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet" href="http://github.com/jquery/qunit/raw/master/qunit/qunit.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://github.com/jquery/qunit/raw/master/qunit/qunit.js"></script>
<script type="text/javascript" src="php.default.min.js"></script>
<script type="text/javascript" src="session_utils.js"></script>

<script type="text/javascript" src="session_start.js"></script>
<script type="text/javascript" src="session_encode.js"></script>
<script type="text/javascript" src="session_destroy.js"></script>
<script type="text/javascript" src="$_SESSION.js"></script>


<script>
$(document).ready(function(){
	module('Session Start');
	test('$_SESSION Exists', function() {
		session_start();
		ok($_SESSION, 'Session Exists');
		ok(getcookie('JSSESSID'), 'Session in cookie');
	});
	test('Modify $_SESSION',function() {
		$_SESSION('test', 'data');
		$_SESSION('coheed', 'yotbr');
		equals($_SESSION.test, 'data', 'Session var exists');
		equals($_SESSION.coheed, 'yotbr', 'Session var exists');
	});
	test('$_SESSION === JSSESSID',function() {
		$_SESSION = null;
		session_start();
		equals($_SESSION.test, 'data', 'Exists after session_start');
		equals($_SESSION.coheed, 'yotbr', 'Exists after session_start');
	});
	test('Session_Encode',function() {
		var se = session_encode();
		ok(se, 'Session encoded');
		equals(se, 'a:2:{s:4:"test";s:4:"data";s:6:"coheed";s:5:"yotbr";}', 'Encoded correctly');
	});
	test('Session Destroy/Unregister/Unset',function() {
		session_destroy();
		equals($_SESSION, null, '$_SESSION empty');
        // Add back for sake of next page
		session_start();
		$_SESSION('test', 'data');
		$_SESSION('coheed', 'yotbr');
    });
});
</script>

</head>
<body>
 <h1 id="qunit-header">QUnit example</h1>
 <h2 id="qunit-banner"></h2>
 <h2 id="qunit-userAgent"></h2>
 <ol id="qunit-tests"></ol>
 <div id="qunit-fixture">test markup, will be hidden</div>
 <a href="test2.html">Page 2</a>
</body>
</html>